package srk.java.demo.swt1;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;

public class Swt_listener_1_5 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setText("Hello world Lister");
		shell.open();

		Listener listener = new Listener1();
		shell.addListener(SWT.MouseDown, listener);

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();

	}

}

class Listener1 implements Listener {

	@Override
	public void handleEvent(Event event) {
		System.out.println("Mouse Down Event");
	}

}
